﻿using K8.EF;
using System.Linq.Expressions;
using System.Reflection.Metadata;

namespace KingerRobot.PCRBW.SpiService;

public interface IMesOutCompleteRepositories
{
    #region 同步查询
    /// <summary>
    /// 根据Id查询实体
    /// </summary>
    /// <param name="objId"></param>
    /// <returns></returns>
    MesOutComplete QueryById(string objId);
    /// <summary>
    /// 根据id数组查询实体list
    /// </summary>
    /// <param name="lstIds"></param>
    /// <returns></returns>
    List<MesOutComplete> QueryByIDs(object[] lstIds);

    /// <summary>
    /// 添加
    /// </summary>
    /// <param name="model"></param>
    /// <returns></returns>
    int Add(MesOutComplete model);

    /// <summary>
    /// 批量添加
    /// </summary>
    /// <param name="listEntity"></param>
    /// <returns></returns>
    int Add(IEnumerable<MesOutComplete> listEntity);

    /// <summary>
    /// 根据id 删除某一实体
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    int DeleteById(string id);


    /// <summary>
    /// 根据id数组，删除实体list
    /// </summary>
    /// <param name="ids"></param>
    /// <returns></returns>
    int Deletes(IEnumerable<MesOutComplete> entitys);

    /// <summary>
    /// 更新model
    /// </summary>
    /// <param name="model"></param>
    /// <returns></returns>
    int Update(MesOutComplete model);

    /// <summary>
    /// 根据model，更新，带where条件
    /// </summary>
    /// <param name="entity"></param>
    /// <param name="strWhere"></param>
    /// <returns></returns>
    int Update(Expression<Func<MesOutComplete, bool>> whereExpression, MesOutComplete entity);

    /// <summary>
    /// 正序查询第一条数据
    /// </summary>
    /// <returns></returns>
    MesOutComplete First();
    /// <summary>
    /// 根据条件查询查询第一条数据
    /// </summary>
    /// <param name="whereExpression"></param>
    /// <returns></returns>
    MesOutComplete First(Expression<Func<MesOutComplete, bool>> whereExpression);

    /// <summary>
    /// 查询
    /// </summary>
    /// <returns></returns>
    List<MesOutComplete> Query();


    /// <summary>
    /// 根据表达式查询
    /// </summary>
    /// <param name="whereExpression"></param>
    /// <returns></returns>
    List<MesOutComplete> Query(Expression<Func<MesOutComplete, bool>> whereExpression);
    /// <summary>
    /// 根据sql语句查询
    /// </summary>
    /// <param name="strSql">完整的sql语句</param>
    /// <param name="parameters">参数</param>
    /// <returns>泛型集合</returns>
    List<MesOutComplete> QuerySql(string strSql, Parameter[] parameters = null);
    /// <summary>
    /// 根据sql语句查询 执行update、delete、add
    /// </summary>
    /// <param name="strSql">完整的sql语句</param>
    /// <param name="parameters">参数</param>
    /// <returns>泛型集合</returns>
    int ExecuteSqlRaw(string strSql, Parameter[] parameters);

    #endregion

    
}
